﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PaginatedPage.aspx.cs"
    Inherits="OpenWaves.Pagination.Showcase.PaginatedPage" %>

<%@ Import Namespace="OpenWaves" %>
<%@ Register TagPrefix="ow" Namespace="OpenWaves.Web.Controls" Assembly="OpenWaves.Web" %>
<%@ Register TagPrefix="ow" Namespace="OpenWaves.Pagination.Controls" Assembly="OpenWaves.Pagination" %>

<ow:OptionalContentPlaceholder runat="server" DataItem="<%# Pagination.CurrentPage%>">
    
    <ow:Repeater runat="server" DataSource="<%# Pagination.CurrentPage.Items %>">
                
        <Template>
            <ul>
                <ow:ItemsPlaceHolder runat="server" />
            </ul>
        </Template>

        <ItemTemplate>
            <li>
                <%# Eval("Name") %>
            </li>
        </ItemTemplate>

    </ow:Repeater>

    <ow:Pager runat="server">
        
        <Template>
            <ow:PageButton runat="server" Page="<%# Pagination.PreviousPage%>" Text="Previous"
                CssClass="prev" />
            <ow:PageRepeater runat="server" DataSource="<%# Pagination.VisiblePages%>">
                <ItemTemplate>
                    <ow:PageButton runat="server" Page="<%#Container.Item%>" />
                </ItemTemplate>
            </ow:PageRepeater>
            <ow:PageButton runat="server" Page="<%# Pagination.NextPage%>" Text="Next" CssClass="next" />
        </Template>

        <PageButtonTemplate>
            <a href="<%# PaginationUrlFactory.GetPageUrl(Container.Page).ToString() %>" class="<%# Container.CssClass %>">
                <%# Html.Encode(Container.Text ?? Container.Page.Number.ToString()) %>
            </a>
        </PageButtonTemplate>

        <UnavailablePageButtonTemplate>            
            <span class="<%# Container.CssClass %>">
                <%# Html.Encode(Container.Text) %></span>
        </UnavailablePageButtonTemplate>

        <SelectedPageButtonTemplate>
            <span class="selected">
                <%# Html.Encode(Container.Page.Number.ToString()) %>
            </span>
        </SelectedPageButtonTemplate>

    </ow:Pager>

</ow:OptionalContentPlaceholder>
